-
Notifications
You must be signed in to change notification settings - Fork 72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: window function calcite support #172
Conversation
enum Direction { | ||
PRECEDING, | ||
FOLLOWING | ||
R visit(Unbounded unbounded); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Direction doesn't have an equivalent in the Substrait spec itself. Calcite has a concept of UNBOUNDED_PRECEDING
and UNBOUNDED_FOLLOWING
, but those can be reduced to singular Unbounded
WindowBound when converting from Calcite to Pojo.
@@ -5,58 +5,62 @@ | |||
@Value.Enclosing | |||
public interface WindowBound { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than encoding the WindowBound type using a combination of BoundedKind and Direction, I've switched this to 4 classes:
- Preceding
- Following
- Current
- Unbounded
and introduced a WindowBoundVisitor to handle dispatch when converting from these to various other representations.
This representation of Window Bounds:
- More closely matches the spec.
- Reduces the need for casting of WindowBound interfaces to concrete types.
- Reduces cognitive complexity (in my opinion) as users no longer need to reason about 6 different enum combinations (3 bounded kinds * 2 directions), and instead have 4 concrete classes.
469e51b
to
bf91fe4
Compare
core/src/main/java/io/substrait/expression/proto/ExpressionProtoConverter.java
Outdated
Show resolved
Hide resolved
feat: support for window bounds type feat: reject IGNORE NULLS BREAKING CHANGE: * windowFunction expression creator now requires window bound type parameter * the WindowBound POJO representation has been reworked to use visitation and more closely match the spec * ExpressionRexConverter now requires a WindowFunctionConverter
…rait-io#172) feat: support for window bounds type feat: reject IGNORE NULLS BREAKING CHANGE: * windowFunction expression creator now requires window bound type parameter * the WindowBound POJO representation has been reworked to use visitation and more closely match the spec * ExpressionRexConverter now requires a WindowFunctionConverter
feat: support for window bounds type
BREAKING CHANGE: